<template>
  <div class="pagek">
    <div class="ReadPageback">
      <div class="ReadPagebackx">
        <img src="../../assets/img/qtk.png" alt="">
        <img src="../../assets/img/stk.png" alt="">
        <img src="../../assets/img/detailedVersion/x.png" alt="" @click="showX()">
      </div>
      <!-- <div class="zejd1"></div> -->
      <!-- 页面内容 -->
      <div class="content">
        <div class="content_comc">
          <!-- 头部 -->
          <div class="table_tit">
            <div>保险条款三级责任解读</div>
            <div>单位(元)</div>
          </div>
          <table border="1" class="table_t">
						<thead class="table_d">
							<tr>
								<th>保险条款名称</th>
								<th>三级责任名称</th>
								<th>三级责任金额</th>
							</tr>
						</thead>
						<tbody>
							<template
								v-for="(item, index) in list" :key="index"
							>
								<tr
									v-for="(items, indexs) in item.safeguardLiabilityInterpretationList" :key="indexs"
									class="table_tr"
								>
									<td
										v-if="indexs === 0"
										:rowspan="item.safeguardLiabilityInterpretationList.length"
									>
										{{ item.insuranceClauseName }}
									</td>
									<td>
										{{ items.tertiaryBilityName }}
									</td>
									<td>
										{{ items.protectionAmount }}
									</td>
                </tr>
							</template>
						</tbody>
					</table>
          <div style="height: 3rem"></div>
        </div>
      </div>
    </div>
  </div>
</template>
<!-- less嵌套设置 -->
<style lang="less" scoped>
table {
  margin: 0;
  padding: 0;
  font-size: 13px;
  border-spacing: 0;
  border-collapse: separate;
  tbody {
    tr {
      &:nth-child(2n + 1) {
        td {
          background-color: transparent;
        }
      }
      &:nth-child(2n + 2) {
        td {
          background-color: #d9ecff;
        }
      }
    }
  }
}
.table_t {
    width: 100%;
    margin-top: 10px;
    min-height: 100px;
    border-bottom: 1.7px solid #D9ECFF;
    th {
      border-top: 1.7px solid #D9ECFF;
      border-left: 1.7px solid #D9ECFF;
    }
    td {
      border-top: 1.7px solid #D9ECFF;
      border-left: 1.7px solid #D9ECFF;
    }

    .tbh {
      span:nth-child(1) {
        font-size: 17px;
      }
      span:nth-child(2) {
        font-size: 13px;
      }
    }
    .table_tr {
      td:last-child {
        border-right: 1.7px solid #D9ECFF;
      }
    }
}
.table_d {
  font-size: 14px;
  border-radius: 10px;
  background: linear-gradient(to bottom, #529eec, #53a4f5);
  tr {
    height: 43px;
    color: #ffffff;
    th {
      border: none !important;
    }
    th:last-child {
      border-top-right-radius: 10px;
    }
    th:first-child {
      border-top-left-radius: 10px;
    }
  }
}
.pagek {
  bottom: 0;
  width: 100vw;
  height: 100vh;
  z-index: 10000;
  overflow: hidden;
  position: absolute;
  transition: all 0.3s ease 0s;
  background: rgba(0, 0, 0, 0.7);
  .ReadPageback {
    bottom: 0;
    width: 100%;
    height: 70%;
    overflow: auto;
    position: absolute;
    border-top-left-radius: 17px;
    border-top-right-radius: 17px;
    background: linear-gradient(180deg, #3296fa 0%, #fdfdfd 70%);
    .ReadPagebackx {
      width: 94%;
      height: 103px;
      display: flex;
      margin: 0 auto;
      justify-content: space-between;
      img:nth-child(1){
        width: 193px;
        height: 29px;
        margin-top: 70px;
      }
      img:nth-child(2){
        width: 101px;
        height: 103px;
      }
      img:nth-child(3) {
        width: 23px;
        height: 23px;
        margin-top: 10px;
      }
    }
    .zejd {
        height: 70px;
        z-index: 100;
        position: fixed;
        margin-top: 10px;
        img {
          width: 100%;
        }
    }
    .zejd1 {
        width: 100%;
        height: 107px;
        // display: none;
        position: fixed;
        background: #3296fa;
        border-top-left-radius: 17px;
        border-top-right-radius: 17px;
    }
    .content {
      width: 94%;
      max-height: 75%;
      overflow: scroll;
      margin: 0 auto;
      padding: 3px 0;
      margin-top: 10px;
      border-radius: 10px;
      background: #fff;
      .content_comc {
        width: 99%;
        margin: 0 auto;
        min-height: 300px;
        border-radius: 10px;
        background: #F0F8FF;
        .table_tit {
          width: 94%;
          display: flex;
          margin: 0 auto;
          padding-top: 10px;
          align-items: flex-end;
          justify-content: space-between;
          div:first-child{
            font-size: 15.3px;
            color: #222222;
            letter-spacing: 1.7px;
          }
          div:last-child {
            font-size: 13px;
            color: #FF9926;
          }
        }
      }
    }
  }
}
</style>


<script lang="ts" setup name="detailedVersionTk">
import { Toast } from "/@/utils/Message";
import { onMounted } from "vue";
import { ref, reactive, computed, nextTick } from "vue";
import { useRouter, useRoute } from "vue-router";
import {
  getResponsibilityInterpretation,
  getResponsibilityInterpretationByScanCode,
  jstJointLogin,
	letterControllerjstUrl
} from "/@/api/auth/simpleVersion.ts";
import customNavBar from "/src/components/NavBar/customNavBar.vue";

import { interactive } from "/@/assets/js/interactive"
const router = useRouter();
const route = useRoute();
const leftTetx = ref("");
const titleTest = ref(" ");
const props = defineProps(['obj'])
let list = reactive([])
const list1 = ref([
  {
    name: "责任",
    content1: [{ aa: "k1" }, { aa: "k1" }, { aa: "k1" }, { aa: "k1" }],
    n: "k3",
  },
  {
    name: "责任",
    content1: [],
    n: "k3",
  },
  {
    name: "责任",
    content1: [],
    n: "k3",
  },
]);
onMounted(() => {
  getData()
});
const getData = (()=>{
  // 扫码
  if (props.obj.isYsc == 1 ? true : false || props.obj.face) {
    getResponsibilityInterpretationByScanCode({
      policyNumber: props.obj.policyNumber,
      companyName: props.obj.companyName,
      insuranceClauseName: props.obj.insuranceClauseName,
      taskCode: props.obj.taskCode,
      token: props.obj.token,
      
    }).then((res: any) => {
      if (res.code == "402") {
        // 金世通来的掉联合登录
					jstJointLogin({ taskCode: route.query.taskCode, token: route.query.token}).then(
						(res: any) => {
							if (res.code == 200) {
								sessionStorage.removeItem('customToken')
								sessionStorage.setItem('customToken', res.customToken)
                getData()
							}  else if (res.code == 40201) {
								//  去金世通返回链接
                // 退出登录并跳转登录页面
                sessionStorage.clear()
                  interactive({
                    method:"reLogin",
                    data:{
											code:'901',
											msg:''
										}
                  })
								// letterControllerjstUrl({}).then((a: any) => {
								// if (a.code == 200) {
                  
								// 	//  Toast('跳转金事通页面')
								// 	// window.location.href = `${a.jstUrl}`;
								// }
								// });
							}
						}
					)
        // Toast("您好，当前状态已失效，请您再次登录或重新打开服务连接"); // ? 还是去金事通
        return;
      }
      if(res.code == 200){
        list.push(res.data)
      }
    });
  } else {
    getResponsibilityInterpretation({
      userType: props.obj.userType,
      policyNumber: props.obj.policyNumber,
      companyName: props.obj.companyName,
      insuranceClauseName: props.obj.insuranceClauseName,
      taskCode: props.obj.taskCode,
    }).then((res: any) => {
      if(res.code == 200){
        list.push(res.data)
      }
    });
  }
})
const $emit = defineEmits<{
  (e: "sendParent1", data: any): void;
}>();
const showX = () => {
  $emit("sendParent1", false);
}
</script>


